#ifndef MATHTOOLS_MATRIXTOOLS_H_
#define MATHTOOLS_MATRIXTOOLS_H_

#include "Vector3D.h"
#include "CPMath.h"

namespace math_tools
{
	// Homogenous 3D transformation matrix.
	typedef double Matrix3D[16];

	// Matrix tools container.
	namespace matrix_tools
	{
		// Copy matrix into another.
		void copyMatrix(const Matrix3D & matrix, Matrix3D & result);

		// Resets the given matrix into an identity matrix.
		void identityMatrix(Matrix3D & matrix);

		//matrix1 * matrix2
		void multiplyMatrix(const Matrix3D & matrix1, const Matrix3D & matrix2, Matrix3D & result);

		// Creates rotation matrix based on vector (the size of the vector represents the angle)
		void rotationMatrix(const Vector3D & vector, Matrix3D & rotation_matrix);
		void rotationMatrix(double angle, const Vector3D & vector, Matrix3D & rotation_matrix);

		// Transforms the vector by the given matrix
		void transform(const Matrix3D & matrix, const Vector3D & vector, Vector3D & result);

		// Creates translation matrix based on the translation vector.
		void translationMatrix(double x, double y, double z, Matrix3D & translation_matrix);
		void translationMatrix(const Vector3D & vector, Matrix3D & translation_matrix);
	}
}

#endif
